<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <link rel="stylesheet" type="text/css" href="__CSS__/lib/normalize.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/mui-3.6.1.min.css" />
    <link rel="stylesheet" type="text/css" href="__CSS__/recharge.css" />
    <title>意见反馈</title>
    <style>
        .mui-input-row .mui-input-clear{
            width: 100%;
            border: none;
            margin: 0;
        }
        .rows{ margin-bottom: 10px; }
        .textarea{ margin: 0 }
    </style>
</head>

<body>
    <div class="top-bar">
        <div class="return" onclick="location.href='/Wx/Service/index'"></div>
        <div class="top-middle">给我们建议</div>
        <div class="top-right"></div>
    </div>

    <div class="rows">
        <textarea id="content" class="textarea" rows="7" placeholder="亲，留下您对客户端的优化建议!"></textarea>
    </div>

    <div class="mui-input-row">
    <input id="phone" type="text" class="mui-input-clear" maxlength="11" placeholder="请留下您的联系方式(手机号)" >
    </div>
    <div class="button-simple gradient-color" onclick="suggest()">提交</div>
    <input type="hidden" value="0"  id="isrepeat"/>
<script src="__JS__/mui-3.6.1.min.js"></script>
<script>
    function suggest(){
        var isrepeat=document.getElementById('isrepeat');
        var content=document.getElementById('content');
        if( isrepeat.value==1){
            mui.toast('请不要重复提交');
            return;
        }
        var content= trim(content.value);
        var phone=document.getElementById('phone').value;
        var telReg = !!phone.match(/^1[3|7|4|5|8]{1}\d{9}$/);
        if (telReg == false) {
            mui.toast('手机格式不正确');
            return;
        }

        isrepeat.value=1;
        mui.post('/Wx/Service/suggestHandle',{
            phone : phone,
            content : content
        },function(data){
            if(data.status==0){
                mui.toast('已收到你的建议');
                setTimeout(function(){
                    location.href="/Wx/Service//index";
                },2000);
            }else{
                mui.toast('提交失败');
                isrepeat.value=0;
            }
        },'json');
    }

        //去左右空格
    function trim(str){
        return str.replace(/^(\s|\u00A0)+/,'').replace(/(\s|\u00A0)+$/,'');
    }
</script>
</body>
</html>
